#define __SDCC_FLOAT_LIB
#include <float.h>

#ifdef FLOAT_ASM_MCS51

// unsigned int __fs2uint (float x)
static void dummy( void ) __naked {
  __asm
  .globl	___fs2uint
  ___fs2uint:
  mov	r7, #142
  lcall	fs2ulong_begin
  mov	dph, a
  mov	dpl, b
  ret
  __endasm;
}

#else

unsigned long __fs2ulong( float a1 );

/* convert float to unsigned int */
unsigned int __fs2uint( float f ) {
  unsigned long ul = __fs2ulong( f );
  if( ul >= UINT_MAX ) {
    return UINT_MAX;
  }
  return ul;
}

#endif
